package com.koron.housing.apply.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.housing.apply.bean.po.HousingStaffRank;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 职称信息(HousingStaffRank)表服务接口
 *
 * @author jzp
 * @since 2022-02-26 15:22:41
 */
public interface HousingStaffRankService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    HousingStaffRank getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param housingStaffRank 查询条件对象
     * @return 列表结果集
     */
    List<HousingStaffRank> list(SessionFactory factory, HousingStaffRank housingStaffRank);

    List<HousingStaffRank> listByApplyId(SessionFactory factory, String applyId);

    /**
     * 分页查询
     *
     * @param housingStaffRank 分页条件
     * @return 对象列表
     */
    default PageInfo<HousingStaffRank> page(SessionFactory factory, PageQuery pageQuery, HousingStaffRank housingStaffRank) {
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<HousingStaffRank> housingStaffRankList = list(factory, housingStaffRank);
        return new PageInfo<>(housingStaffRankList);
    }

    /**
     * 新增数据
     *
     * @param housingStaffRank 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, HousingStaffRank housingStaffRank);

    boolean saveBatch(SessionFactory factory, List<HousingStaffRank> rankList);

    /**
     * 修改数据
     *
     * @param housingStaffRank 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, HousingStaffRank housingStaffRank);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(SessionFactory factory, String id);

    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByApplyId(SessionFactory factory, String applyId);

}
